<?php
/**
 * MVC_VIEW
 * @Version 1.0
 * date: 08May2008
 * 
 * @author Thanh NV
 * sony_k48@yahoo.com
 * 
*/
class MVC_VIEW {
	public $oTemp;
	public $oLang;
	
	public function __construct(){
		
	}
	
	public function setTemplate($templateFile){
		$this->oTemp = new XTemplate( $templateFile );
		
		$this->oTemp->assign('URL_CSS',URL_CSS);
		$this->oTemp->assign('URL_JS',URL_JS);
		$this->oTemp->assign('URL_UPLOAD',URL_UPLOAD);
		$this->oTemp->assign('URL_TEMPLATE_HOME',URL_TEMPLATE_HOME);
		$this->oTemp->assign('URL_TEMPLATE_ADMIN',URL_TEMPLATE_ADMIN);
		$this->oTemp->assign('URL_TEMPLATE_MEMBER',URL_TEMPLATE_MEMBER);
		$this->oTemp->assign('URL_TEMPLATE_OWNER',URL_TEMPLATE_OWNER);
		
		$this->oLang = new MVC_Read_ini();
	}
	
	public function printHTML($block='main'){
		eval("?".">".$this->oTemp->text($block));
	}
	
	public function returnHTML($block='main'){
		return $this->oTemp->text($block);
	}
	
	public function translate($lang_file){
		$this->oLang->set_file($lang_file);
		$aLanguage = $this->oLang->parse();
		
		$this->assignExtract($aLanguage);
	}
	
	public function assignExtract($aData){
		if(is_array($aData)){
			foreach ($aData as $sKey => $sValue){
                                
				$this->oTemp->assign($sKey, $sValue);
			}
		}
	}
}
?>